package com.bigtotoro.util;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by xiaobing on 15/7/10.
 */
public class HttpUtil {
    /**
     *
     * @param url
     * @param maps
     * @return
     */
    public static String encodeUrl(String url, Map<String, String> maps){
        StringBuilder sb = new StringBuilder(url+"?");
        for (String key: maps.keySet()){
            sb.append(key+"="+maps.get(key)+"&");
        }
        String result =  sb.toString();
        if(result.endsWith("&")){
            result = result.substring(0, result.length()-1);
        }
        return result;
    }
}
